/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package com.lifesting.workflow.runtime.impl;

import com.lifesting.workflow.runtime.AccessManager;
import com.lifesting.workflow.runtime.ProcessExecutor;
import com.lifesting.workflow.runtime.RuntimePackage;
import com.lifesting.workflow.runtime.TaskManager;
import com.lifesting.workflow.runtime.Token;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Process Executor</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.lifesting.workflow.runtime.impl.ProcessExecutorImpl#getInitialToken <em>Initial Token</em>}</li>
 *   <li>{@link com.lifesting.workflow.runtime.impl.ProcessExecutorImpl#getProcess <em>Process</em>}</li>
 *   <li>{@link com.lifesting.workflow.runtime.impl.ProcessExecutorImpl#getAccessManager <em>Access Manager</em>}</li>
 *   <li>{@link com.lifesting.workflow.runtime.impl.ProcessExecutorImpl#getTaskManager <em>Task Manager</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ProcessExecutorImpl extends ExecutorImpl implements ProcessExecutor {
	/**
	 * The cached value of the '{@link #getInitialToken() <em>Initial Token</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInitialToken()
	 * @generated
	 * @ordered
	 */
	protected Token initialToken;

	/**
	 * The cached value of the '{@link #getProcess() <em>Process</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProcess()
	 * @generated
	 * @ordered
	 */
	protected com.lifesting.workflow.model.gd.Process process;
	/**
	 * The cached value of the '{@link #getAccessManager() <em>Access Manager</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAccessManager()
	 * @generated
	 * @ordered
	 */
	protected AccessManager accessManager;
	/**
	 * The cached value of the '{@link #getTaskManager() <em>Task Manager</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTaskManager()
	 * @generated
	 * @ordered
	 */
	protected TaskManager taskManager;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ProcessExecutorImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return RuntimePackage.Literals.PROCESS_EXECUTOR;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Token getInitialToken() {
		if (initialToken != null && initialToken.eIsProxy()) {
			InternalEObject oldInitialToken = (InternalEObject)initialToken;
			initialToken = (Token)eResolveProxy(oldInitialToken);
			if (initialToken != oldInitialToken) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.PROCESS_EXECUTOR__INITIAL_TOKEN, oldInitialToken, initialToken));
			}
		}
		return initialToken;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Token basicGetInitialToken() {
		return initialToken;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInitialToken(Token newInitialToken) {
		Token oldInitialToken = initialToken;
		initialToken = newInitialToken;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.PROCESS_EXECUTOR__INITIAL_TOKEN, oldInitialToken, initialToken));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public com.lifesting.workflow.model.gd.Process getProcess() {
		if (process != null && process.eIsProxy()) {
			InternalEObject oldProcess = (InternalEObject)process;
			process = (com.lifesting.workflow.model.gd.Process)eResolveProxy(oldProcess);
			if (process != oldProcess) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.PROCESS_EXECUTOR__PROCESS, oldProcess, process));
			}
		}
		return process;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public com.lifesting.workflow.model.gd.Process basicGetProcess() {
		return process;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setProcess(com.lifesting.workflow.model.gd.Process newProcess) {
		com.lifesting.workflow.model.gd.Process oldProcess = process;
		process = newProcess;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.PROCESS_EXECUTOR__PROCESS, oldProcess, process));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AccessManager getAccessManager() {
		if (accessManager != null && accessManager.eIsProxy()) {
			InternalEObject oldAccessManager = (InternalEObject)accessManager;
			accessManager = (AccessManager)eResolveProxy(oldAccessManager);
			if (accessManager != oldAccessManager) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.PROCESS_EXECUTOR__ACCESS_MANAGER, oldAccessManager, accessManager));
			}
		}
		return accessManager;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AccessManager basicGetAccessManager() {
		return accessManager;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAccessManager(AccessManager newAccessManager) {
		AccessManager oldAccessManager = accessManager;
		accessManager = newAccessManager;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.PROCESS_EXECUTOR__ACCESS_MANAGER, oldAccessManager, accessManager));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TaskManager getTaskManager() {
		if (taskManager != null && taskManager.eIsProxy()) {
			InternalEObject oldTaskManager = (InternalEObject)taskManager;
			taskManager = (TaskManager)eResolveProxy(oldTaskManager);
			if (taskManager != oldTaskManager) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, RuntimePackage.PROCESS_EXECUTOR__TASK_MANAGER, oldTaskManager, taskManager));
			}
		}
		return taskManager;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TaskManager basicGetTaskManager() {
		return taskManager;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTaskManager(TaskManager newTaskManager) {
		TaskManager oldTaskManager = taskManager;
		taskManager = newTaskManager;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, RuntimePackage.PROCESS_EXECUTOR__TASK_MANAGER, oldTaskManager, taskManager));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case RuntimePackage.PROCESS_EXECUTOR__INITIAL_TOKEN:
				if (resolve) return getInitialToken();
				return basicGetInitialToken();
			case RuntimePackage.PROCESS_EXECUTOR__PROCESS:
				if (resolve) return getProcess();
				return basicGetProcess();
			case RuntimePackage.PROCESS_EXECUTOR__ACCESS_MANAGER:
				if (resolve) return getAccessManager();
				return basicGetAccessManager();
			case RuntimePackage.PROCESS_EXECUTOR__TASK_MANAGER:
				if (resolve) return getTaskManager();
				return basicGetTaskManager();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case RuntimePackage.PROCESS_EXECUTOR__INITIAL_TOKEN:
				setInitialToken((Token)newValue);
				return;
			case RuntimePackage.PROCESS_EXECUTOR__PROCESS:
				setProcess((com.lifesting.workflow.model.gd.Process)newValue);
				return;
			case RuntimePackage.PROCESS_EXECUTOR__ACCESS_MANAGER:
				setAccessManager((AccessManager)newValue);
				return;
			case RuntimePackage.PROCESS_EXECUTOR__TASK_MANAGER:
				setTaskManager((TaskManager)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case RuntimePackage.PROCESS_EXECUTOR__INITIAL_TOKEN:
				setInitialToken((Token)null);
				return;
			case RuntimePackage.PROCESS_EXECUTOR__PROCESS:
				setProcess((com.lifesting.workflow.model.gd.Process)null);
				return;
			case RuntimePackage.PROCESS_EXECUTOR__ACCESS_MANAGER:
				setAccessManager((AccessManager)null);
				return;
			case RuntimePackage.PROCESS_EXECUTOR__TASK_MANAGER:
				setTaskManager((TaskManager)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case RuntimePackage.PROCESS_EXECUTOR__INITIAL_TOKEN:
				return initialToken != null;
			case RuntimePackage.PROCESS_EXECUTOR__PROCESS:
				return process != null;
			case RuntimePackage.PROCESS_EXECUTOR__ACCESS_MANAGER:
				return accessManager != null;
			case RuntimePackage.PROCESS_EXECUTOR__TASK_MANAGER:
				return taskManager != null;
		}
		return super.eIsSet(featureID);
	}

} //ProcessExecutorImpl
